home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 7
/
Aminet 7 - August 1995.iso
/
Aminet
/
comm
/
cnet
/
formlett11.lha
/
FormLett.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-12-04
|
6KB
|
226 lines
/*
If you find yourself sending the same "Form-Letter" to users, again
and again, this pfile is for you.
> Send to acct #, real-name, handle: 182
>
> Acct John Doe (#182 Johnny) has been sent Letter #D 5 times.
> Acct John Doe (#182 Johnny) has been sent Letter #B 3 times.
>
> [A] Welcome mail
> [B] Account about to expire
> [C] U/Ling to wrong area
> [D] FileNote short/vague
> [E] FileNote missing
> [F] Inappropriate msg post
> [G] System problem
> [H] Thanks for the suggestion
>
> Send which letter: C
>
> Acct #182 sent form-letter regarding "Acct about to expire".
Installation:
1) Copy FormLett.rexx TO Pfiles:
2) Copy *.form TO SysText:
3) Add the following file onto the END of your
BBSmenu "1; Maintenance menu" list:
FORmletter | {#0 pfiles:FormLett.rexx}
4) Edit your "SysData:FormLett.cfg" file to reflect the
files you wish to send to users, subjects, and your menu display.
5) Create the text-files that you've entered in "SysData:FormLett.cfg".
(Or use the *.form files that are provided in this archive.)
These *.form files are what gets sent to the users.
6) Edit the variables below marked as "user-editable variables".
If you set the variable shown below called "tally" to "1", FormLett.rexx
will create various Form_Lett.A files within each user's HOME directory.
This will allow you to track how many times you've had to send a certain
user the same reminder.
If you later wish to delete these tally-files, execute the DOS cmd:
> Delete Mail:Users/#?/Form_Lett.?
If you set the variable shown below called "log" to "1", FormLett.rexx
will write usage to the logs. (You'll also have to have CONFIG/LOGS
"ArexxSays" field turned on, as well as that user's log-flags.)
$VER: FormLett.rexx v1.1 Thu 02-Dec-93 23:40:23
First public release.
$VER: FormLett.rexx v1.0 Tue 29-Jun-93 07:16:45
Written and tested with CNet v2.94-beta
"[A] Custom" not yet supported.
Bill Beogelein
Box 530441
Livonia, MI 48153
BBS 810-473-2020, Fido 1:2410/207
Ignore:
lz u CNet3:FormLett.LHA Pfiles:rexx/FormLett.#? a:zzzBBS SysText:nmail
lz u CNet3:FormLett.LHA SysText:#?.form SysData:FormLett.#? Gfiles:FAQ1/#?.form
Copy CNet3:FormLett.LHA UP:
Future plans and known bugs:
After CNet v3.0 is released, use 'getuser' instead of editpath variable.
Turning on "tally" wastes disk-space by creating many small files.
Allow FormLett to be callable from the edit using the current handle.
Loop in menu exit RETURN is hit.
*/
/******* Top of user-editable variables *********/
editpath = "R:p/" /* Your CNet CONFIG/PATH "editor temp-files path" */
cfgfile = "SysData:FormLett.cfg" /* Name/location of your FormLett.cfg file */
/* In each of the following cases... 0=NO, 1=YES */
tally = 1 /* Track of how many times letters have been sent. */
log = 1 /* Write usage to logs. */
/******* End of user-editable variables ***********/
options results
call ToLog("Running pfile FormLett.rexx.")
call LoadCfg()
'getuser' 23; port=RESULT
'transmit' "n1 FormLett by Bill Beogelein"
'query' "n1Send to acct #, real-name, handle [none]: "; ans=RESULT
if(ans="" | ans<1) then abort()
'FindAccount' ans
acct=RESULT
'loadScratch' acct
if(RESULT==1) then
do
'getScratch' 1; handle = RESULT
'getScratch' 3; realname = RESULT
'getScratch' 39; home = RESULT
'saveScratch' acct*(-1)
end
else
exit /* CNet will tell user, "acct not found" */
if(tally) then call ShowCount()
do i=1 to max
'transmit' "[" || d2c(i+64) || "]" a.i.2
end
'sendString' "n1Send which letter to" realname "(#" || acct handle || ") [none]: "; 'getchar'; alpha=RESULT; 'transmit' alpha
letter=c2d(alpha)-64
if(letter<1 | letter>max) then abort()
defSubj = a.letter.1
'query' "n1Subject [" || defSubj || "]: "; subj=RESULT
if(subj="") then subj=defSubj
'transmit' ""
fname = a.letter.3
if(~exists(fname)) then
do
'transmit' "*** Can't find filename" fname
exit
end
'SetMailSubj' subj
tmpbuf = editpath || "_edbuff" || port
cmd = "Copy" fname "to" tmpbuf
'transmit' cmd; address command cmd
'WriteMail' acct
ok=RESULT
if(ok='1') then
do
'transmit' "Sent" fname "to acct #" || acct
if(tally) then call IncCount(alpha)
call ToLog("FormLett.rexx sent" fname "to acct #" || acct)
end
else
'transmit' "*** Can't send" fname "TO acct #" || acct
'transmit' "Done."
exit
Abort:
'transmit' "n1*** FormLett.rexx aborted"
exit
ShowCount: /* Open Mail:Users/#/Form_Lett.A .B .C */
'transmit' ""
do which=65 to 65+26
countFile = "Mail:Users/" || home || "/Form_Lett." || d2c(which)
if(open(fp9, countFile, 'READ')) then
do
SentCount=readLN(fp9)
call close(fp9)
if(SentCount>0) then
'transmit' realname "(#" || acct handle || ") has been sent Letter #" || d2c(which) SentCount "times."
end
end
'transmit' ""
return
IncCount:
parse arg which
SentCount=0
countFile = "Mail:Users/" || home || "/Form_Lett." || which
if(open(fp9, countFile, 'READ')) then
do
SentCount=readLN(fp9)
call close(fp9)
end
if(open(fp9, countFile, 'WRITE')) then
do
call writeLN(fp9, SentCount+1)
end
else
'transmit' "n2 *** Can't open" countFile "for write. n2"
return
ToLog:
parse arg LogString
if(log) then 'LogEntry' LogString
return
LoadCfg:
if(open(fp4, cfgfile, 'READ')) then /* SysData:FormLett.cfg */
do
do i=1 to 500
do j=1 to 3
a.i.j=strip(readLN(fp4))
if(eof(fp4)) then
do
max=i-1
return
end
if( a.i.j = '' | left(a.i.j, 1, 1)=';' ) then j=j-1 /* Skip comment-lines */
end
end
end
else
'transmit' "n2 *** Can't open" cfgfile "for read. n2"
return
/*
SETMAILSUBJ {s} This command should be performed before
EACH WRITEMAIL in order to set the SUBJECT
of the mail about to be sent.
WRITEMAIL {s} Write the contents of the editor temp
buffer to the user's mailbox specified
by {s}. {s} must be a valid account
number. RESULT will carry a "1" if
everything was sent OK, "0" otherwise.
*/
/*** EOF Pfiles:rexx/FormLett.rexx by Bill Beogelein 810-473-2020 ***/